//
// Created by yycs0 on 25-2-11.
//

#ifndef PUSHBOX_PUSHBOXGAME_H
#define PUSHBOX_PUSHBOXGAME_H

#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cstring>
#include <fstream>
struct Target
{
    int x;
    int y;
};
struct MapInfo{
    std::vector<Target> targets;
    int yMin;
    int yMax;
    int xMin;
    int xMax;
    int yMinTgts;
    int yMaxTgts;
    int xMinTgts;
    int xMaxTgts;
    std::vector<int> blockPosx;
    std::vector<int> blockPosy;
};
struct State
{
    std::vector<int> boxx;
    std::vector<int> boxy;
    int px;
    int py;
};
struct Action
{
    int type;//0 Move, 1Push
    int dx;
    int dy;
};
struct ActionState
{
    State state;
    Action action;
};
struct PathState
{
    State state;
    std::vector<Action> actions;
};

void LoadLevelsFromFile(const std::string& filename,std::vector<std::vector<std::vector<char>>>& grids, std::vector<std::string>& titles);
std::vector<Action> SolvePushBox(const State& state, std::vector<std::vector<char>>& grid,const MapInfo& mapInfo);
void printGame(const std::vector<std::vector<char>>& grid);
std::vector<std::vector<char>> getMap(const std::vector<std::vector<char>>& ingrid, State& info, MapInfo& mapInfo);
bool isAction(Action &action, const State &cur_state, std::vector<std::vector<char>>& grid);
State move(const Action& action, const State &cur_state, std::vector<std::vector<char>>& grid);
bool isRight(const State& cur_state, const std::vector<std::vector<char>> &grid, const MapInfo& mapInfo);
#endif //PUSHBOX_PUSHBOXGAME_H
